const $api = ({url,data,method,header})=>{
	// #ifdef MP-WEIXIN
	// let baseURL = "http://192.168.1.161:8586"
	let baseURL = "https://grove.cpzsyun.com:82/ryapi"
	// #endif
	// #ifdef H5
	let baseURL = "/api"
	// #endif
	let promise = new Promise((resolve,reject)=>{
		let auto = {
			token:uni.getStorageSync("account").token
		}
			uni.request({
				url:baseURL+url,
				data,
				method:method || 'POST',
				header:header || auto
				
			}).then((res)=>{
				if(res.data.code == 105){
					uni.$u.toast(res.data.msg)
					uni.reLaunch({
						url:"/pages/index"
					})
				}
				resolve(res)
			}).catch((err)=>{
				reject(err)
			})
	})
	return promise
}
export default $api